<template>
    <el-dialog
      :title="title"
      :close-on-click-modal="false"
      :visible.sync="visible"
      :before-close="cancel"
      class="JNPF-dialog JNPF-dialog_center"
      lock-scroll
      width="55%"
    >
      <el-row :gutter="15" class="">
        <el-form
          ref="elForm"
          :model="dataForm"
          :rules="rules"
          label-width="100px"
        >
         
        <el-col :span="12">
            <el-form-item label="讲师编号" class="required" prop="FCATNO">
              <el-input
                v-model="dataForm.FCATNO"
                placeholder="请输入"
                clearable
                :disabled="!insertorupdate"
                maxlength="8"
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

         <el-col :span="12">
            <el-form-item label="讲师等级">
              <el-select v-model="dataForm.FPARENTNO" placeholder="请选择">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          
          <el-col :span="12">
            <el-form-item class="required" label="讲师名称" prop="FCATNAME">
              <el-input
                v-model="dataForm.FCATNAME"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item class="required" label="性别" prop="FSEX">
              <el-radio v-model="radio" label="1">男</el-radio>
              <el-radio v-model="radio" label="2">女</el-radio>
            </el-form-item>
          </el-col>

          <el-col :span="12">
          <el-form-item label="起任日期" prop="FBEGDATE" >
            <el-date-picker v-model="dataForm.FBEGDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期" >
            </el-date-picker>
          </el-form-item>
         </el-col>

         <el-col :span="12">
            <el-form-item label="状态">
              <el-select v-model="dataForm.FSTATE" placeholder="请选择" >
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="手机号码">
              <el-input
                v-model="dataForm.FTELNO"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item class="required" label="电子邮箱" prop="FEMAIL">
              <el-input
                v-model="dataForm.FEMAIL"
                placeholder="请输入"
                clearable
                :style="{ width: '100%' }"
              >
              </el-input>
            </el-form-item>
          </el-col>


          <el-col :span="24">
            <el-form-item class="required" label="讲师介绍" prop="FADDRESS">
              <el-input
                type="textarea"
                :rows="3"
                placeholder="请输入内容"
                v-model="dataForm.FADDRESS">
              </el-input>
            </el-form-item>
          </el-col>

          <el-col :span="12">
            <el-form-item label="图片">
              <el-image
                style="width: 100px; height: 100px"
                :src="url"
                :fit="fit"></el-image>
            </el-form-item>
          </el-col>

        </el-form>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button  v-if="insertorupdate" type="primary" v-loading="loading">确 定</el-button>
        <el-button v-else type="primary"  v-loading="loading">修 改</el-button>
      </span>
    </el-dialog>
  </template>
  <script>
  import jnpf from "@/utils/jnpf"
  export default {
    props: {
      parelist: {
        type: Array,
        default: []
      },
    },
    data() {
      return {
          radio: '1',
          url: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',

          title:"新增",
          dataForm:{
            FPARENTNO:"高级讲师",
            FCATNO:"100001",
            FCATNAME:"孔子",
            FSEX:"男",
            FBEGDATE:"2000-01-01",
            FTELNO:"135****5638",
            FEMAIL:"",
            FADDRESS:"琴棋书画样样精通",
            FSTATE:"在职"
          },
          rules: {
            FCATNO: [
                  { required: true, message: '请输入讲师编号', trigger: 'blur' },
              ],
              FCATNAME: [
                  { required: true, message: '请输入讲师名称', trigger: 'blur' },
              ],
          },
        fvisiblelist:[
          {id:"1",fullName:"是"},
          {id:"2",fullName:"否"},
        ],
        //所属校区选择数据
        options1: [{
          value: '1',
          label: '在职'
        }, {
          value: '2',
          label: '离职'
        }],
        loading:false,
        visible:false,
        insertorupdate:true
      };
    },
    created() {
    },
    mounted() {},
    methods: {
      //
      init(id){
        this.dataForm.FCATNO= id || ''
          if(this.dataForm.FCATNO)
          {
              this.title="修改"
             this.insertorupdate=false;
          }
          else
          {
            this.insertorupdate=true;
              this.title="新增";
          }
          this.visible=true;
      },
      //
      cancel(){
          this.$refs.elForm.resetFields();
          this.visible=false;
      },
    },
  };
  </script>
  
  
  
  
  